hironobu-s / vagrant-conoha Goto Github PK
View Code? Open in Web Editor NEWThis project forked from ggiamarchi/vagrant-openstack-provider
Vagrant providor for ConoHa VPS
This project forked from ggiamarchi/vagrant-openstack-provider
Vagrant providor for ConoHa VPS
vagrantで作成したVMにローカルネットワークを接続したいため、以下のようにconfig.vm.providerのnetworksパラメータを指定してvagrant up --provider=conohaを実行しました。
※ネットワークのIDは一部伏字にしています。
config.vm.provider :conoha do |conoha|
...
conoha.networks = [
'ext-150-95-180-0-23',
{
id: '4a4e196b-a5b1-4***-9***-477fe0d43***',
address: '10.0.1.10'
}
]
networksで指定したネットワーク名とIDは、それぞれvagrant openstack subnet-listとvagrant openstack network-listで表示されたものを指定しています(ext-150-...のほうはそのうちの1個を選択)。
しかし、作成後にVMにSSHでログインしてip linkやdmesgで確認しても、ローカルネットワークに接続されたインタフェースが存在しません。またSSHで接続できるIPアドレスも指定したext-150-...とはサブネットが異なるようです。
~/work/vagrant-conoha$ vagrant up --provider=conoha
Bringing machine 'default' up with 'conoha' provider...
==> default: The following configuration settings are deprecated and should be
==> default: removed: rsync_includes, rsync_ignore_files, sync_method. Using these
==> default: settings causes the OpenStack provider to fall back to an old synced
==> default: folder implementation instead of using standard Vagrant synced folders.
==> default: Finding flavor for server...
==> default: Finding image for server...
==> default: Finding network(s) for server...
==> default: Launching a server with the following settings...
==> default: -- Tenant : gnct********
==> default: -- Name : default
==> default: -- Flavor : g-1gb
==> default: -- FlavorRef : 7eea7469-0d85-4f82-8050-6ae742394681
==> default: -- Image : vmi-ubuntu-16.04-amd64-unified
==> default: -- ImageRef : b9e54c41-cda9-4d84-8248-808bfaf6c793
==> default: -- KeyPair : conoha
==> default: -- Networks : 22ea9a35-c4d1-47f6-9873-479494485af9, 4a4e196b-a5b1-4***-9***-477fe0d43*** (10.0.1.10)
==> default: Waiting for the server to be built...
==> default: Waiting for machine to boot. This may take a few minutes...
default: SSH address: 150.95.152.109:22
default: SSH username: root
default: SSH auth method: private key
==> default: Machine booted and ready!
==> default: Rsyncing folder: /home/nobu/work/vagrant-conoha/ => /vagrant
~/work/vagrant-conoha$ vagrant ssh -c 'ip link'
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: ens3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT group default qlen 1000
link/ether 02:01:96:5f:98:6d brd ff:ff:ff:ff:ff:ff
Connection to 150.95.152.109 closed.
このnetworksパラメータでの接続先ネットワークの指定は、サポートされていないのでしょうか?
もしサポートされていない場合、vagrant upのときにVMをローカルネットワークに接続する方法を教えてください。webのコンソール画面でローカルネットワークに接続する操作は知っていますが、手動操作を排したいため、vagrant-conohaもしくは他のCLIツールなどを併用しての方法があればと思います。
切り分けができていないのですが、現象を報告します。
私のほうでも余裕あったら切り分け試してみます。
vagrant 1.8.3 @ MacOSX 10.11.5 環境で
vagrant plugin install vagrant-conoha
を叩くと、以下のようにエラー終了します。
Installing the 'vagrant-conoha' plugin. This can take a few minutes...
/opt/vagrant/embedded/gems/gems/bundler-1.12.0/lib/bundler/resolver.rb:303:in `block in sort_dependencies': undefined method `payload' for nil:NilClass (NoMethodError)
from /opt/vagrant/embedded/gems/gems/bundler-1.12.0/lib/bundler/resolver.rb:300:in `each'
from /opt/vagrant/embedded/gems/gems/bundler-1.12.0/lib/bundler/resolver.rb:300:in `sort_by'
from /opt/vagrant/embedded/gems/gems/bundler-1.12.0/lib/bundler/resolver.rb:300:in `sort_dependencies'
from /opt/vagrant/embedded/gems/gems/bundler-1.12.0/lib/bundler/vendor/molinillo/lib/molinillo/resolution.rb:131:in `block (2 levels) in <class:Resolution>'
from /opt/vagrant/embedded/gems/gems/bundler-1.12.0/lib/bundler/vendor/molinillo/lib/molinillo/resolution.rb:431:in `push_state_for_requirements'
from /opt/vagrant/embedded/gems/gems/bundler-1.12.0/lib/bundler/vendor/molinillo/lib/molinillo/resolution.rb:423:in `require_nested_dependencies_for'
from /opt/vagrant/embedded/gems/gems/bundler-1.12.0/lib/bundler/vendor/molinillo/lib/molinillo/resolution.rb:411:in `activate_spec'
from /opt/vagrant/embedded/gems/gems/bundler-1.12.0/lib/bundler/vendor/molinillo/lib/molinillo/resolution.rb:353:in `attempt_to_swap_possibility'
from /opt/vagrant/embedded/gems/gems/bundler-1.12.0/lib/bundler/vendor/molinillo/lib/molinillo/resolution.rb:333:in `attempt_to_activate_existing_spec'
from /opt/vagrant/embedded/gems/gems/bundler-1.12.0/lib/bundler/vendor/molinillo/lib/molinillo/resolution.rb:318:in `attempt_to_activate'
from /opt/vagrant/embedded/gems/gems/bundler-1.12.0/lib/bundler/vendor/molinillo/lib/molinillo/resolution.rb:147:in `process_topmost_state'
from /opt/vagrant/embedded/gems/gems/bundler-1.12.0/lib/bundler/vendor/molinillo/lib/molinillo/resolution.rb:72:in `resolve'
from /opt/vagrant/embedded/gems/gems/bundler-1.12.0/lib/bundler/vendor/molinillo/lib/molinillo/resolver.rb:42:in `resolve'
from /opt/vagrant/embedded/gems/gems/bundler-1.12.0/lib/bundler/resolver.rb:201:in `start'
from /opt/vagrant/embedded/gems/gems/bundler-1.12.0/lib/bundler/resolver.rb:184:in `resolve'
from /opt/vagrant/embedded/gems/gems/bundler-1.12.0/lib/bundler/definition.rb:200:in `resolve'
from /opt/vagrant/embedded/gems/gems/bundler-1.12.0/lib/bundler/definition.rb:140:in `specs'
from /opt/vagrant/embedded/gems/gems/bundler-1.12.0/lib/bundler/definition.rb:129:in `resolve_remotely!'
from /opt/vagrant/embedded/gems/gems/bundler-1.12.0/lib/bundler/installer.rb:195:in `resolve_if_need'
from /opt/vagrant/embedded/gems/gems/bundler-1.12.0/lib/bundler/installer.rb:70:in `run'
from /opt/vagrant/embedded/gems/gems/bundler-1.12.0/lib/bundler/installer.rb:22:in `install'
from /opt/vagrant/embedded/gems/gems/vagrant-1.8.3/lib/vagrant/bundler.rb:230:in `block in internal_install'
from /opt/vagrant/embedded/gems/gems/vagrant-1.8.3/lib/vagrant/bundler.rb:290:in `block in with_isolated_gem'
from /opt/vagrant/embedded/lib/ruby/2.2.0/rubygems/user_interaction.rb:45:in `use_ui'
from /opt/vagrant/embedded/gems/gems/vagrant-1.8.3/lib/vagrant/bundler.rb:289:in `with_isolated_gem'
from /opt/vagrant/embedded/gems/gems/vagrant-1.8.3/lib/vagrant/bundler.rb:229:in `internal_install'
from /opt/vagrant/embedded/gems/gems/vagrant-1.8.3/lib/vagrant/bundler.rb:102:in `install'
from /opt/vagrant/embedded/gems/gems/vagrant-1.8.3/lib/vagrant/plugin/manager.rb:62:in `block in install_plugin'
from /opt/vagrant/embedded/gems/gems/vagrant-1.8.3/lib/vagrant/plugin/manager.rb:72:in `call'
from /opt/vagrant/embedded/gems/gems/vagrant-1.8.3/lib/vagrant/plugin/manager.rb:72:in `install_plugin'
from /opt/vagrant/embedded/gems/gems/vagrant-1.8.3/plugins/commands/plugin/action/install_gem.rb:37:in `call'
from /opt/vagrant/embedded/gems/gems/vagrant-1.8.3/lib/vagrant/action/warden.rb:34:in `call'
from /opt/vagrant/embedded/gems/gems/vagrant-1.8.3/lib/vagrant/action/builder.rb:116:in `call'
from /opt/vagrant/embedded/gems/gems/vagrant-1.8.3/lib/vagrant/action/runner.rb:66:in `block in run'
from /opt/vagrant/embedded/gems/gems/vagrant-1.8.3/lib/vagrant/util/busy.rb:19:in `busy'
from /opt/vagrant/embedded/gems/gems/vagrant-1.8.3/lib/vagrant/action/runner.rb:66:in `run'
from /opt/vagrant/embedded/gems/gems/vagrant-1.8.3/plugins/commands/plugin/command/base.rb:14:in `action'
from /opt/vagrant/embedded/gems/gems/vagrant-1.8.3/plugins/commands/plugin/command/install.rb:32:in `block in execute'
from /opt/vagrant/embedded/gems/gems/vagrant-1.8.3/plugins/commands/plugin/command/install.rb:31:in `each'
from /opt/vagrant/embedded/gems/gems/vagrant-1.8.3/plugins/commands/plugin/command/install.rb:31:in `execute'
from /opt/vagrant/embedded/gems/gems/vagrant-1.8.3/plugins/commands/plugin/command/root.rb:56:in `execute'
from /opt/vagrant/embedded/gems/gems/vagrant-1.8.3/lib/vagrant/cli.rb:42:in `execute'
from /opt/vagrant/embedded/gems/gems/vagrant-1.8.3/lib/vagrant/environment.rb:302:in `cli'
from /opt/vagrant/embedded/gems/gems/vagrant-1.8.3/bin/vagrant:174:in `<main>'
以下の手順で操作すると、3)のvagrant upした時に、Vagrantfile と同じディレクトリにあるmachines/default/conoha/id ファイルにOpenStack ServerのInstance IDを更新するはずが、更新されない。
それにより、4)のdestroyが失敗。
実際のvmが消えてしまうが、vagrant status-globalにvmが残っとしまって、
詰んでしまう。
動作環境
# vagrant --version
Vagrant 1.9.6
# vagrant plugin list
vagrant-conoha (0.1.8)
vagrant-share (1.1.9, system)
# cat /etc/redhat-release
CentOS Linux release 7.3.1611 (Core)
# uname -r
3.10.0-514.6.2.el7.x86_64
(openstack)[root@host gmo-tech-boot-demo02(sjc1)]# grep -r 91ec0cd3-bc07-4bfd-957a-bd936e580a9f ./.vagrant/
./.vagrant/machines/default/conoha/id:91ec0cd3-bc07-4bfd-957a-bd936e580a9f
vagrant destroyが失敗したら、IDの保存されているディレクトリを削除する
(これだと、ホスト単位のdestroyには対応できないので、暫定対応)
# vagrant destroy
==> default: Deleting server...
Vagrant was unable to find the OpenStack instance used for your vagrant machine.
This can happen when the instance has been deleted via OpenStack APIs or OpenStack
Dashboard instead of using vagrant commands.
We recommend using the command `vagrant openstack reset` to reset
vagrant to a clear state
# rm -rvf .vagrant/machines/default/conoha/
creator_uid id index_uuid vagrant_cwd
(openstack)[root@host-163-44-113-230 gmo-tech-boot-demo02(keystone_nwe_conoha_gncu23217513.sjc1)]# rm -rvf .vagrant/machines/default/conoha/*
removed ‘.vagrant/machines/default/conoha/creator_uid’
removed ‘.vagrant/machines/default/conoha/id’
removed ‘.vagrant/machines/default/conoha/index_uuid’
removed ‘.vagrant/machines/default/conoha/vagrant_cwd’
# rm -rvf ~/.vagrant.d/data/
removed ‘/root/.vagrant.d/data/checkpoint_cache’
removed ‘/root/.vagrant.d/data/checkpoint_signature’
removed ‘/root/.vagrant.d/data/lock.dotlock.lock’
removed ‘/root/.vagrant.d/data/lock.machine-action-339c2632216fc47e5cf0b72168d80a94.lock’
removed ‘/root/.vagrant.d/data/machine-index/index.lock’
removed ‘/root/.vagrant.d/data/machine-index/index’
removed directory: ‘/root/.vagrant.d/data/machine-index’
removed directory: ‘/root/.vagrant.d/data/’
config.vm.synced_folder ".", "/vagrant"
上記の設定している際に、新規でのインスタンス作成が
$ vagrant up --provider=conoha
# 略
Machine booted and ready
以降、DEBUG ssh: Sending SSH keep-alive...
をデバッグログへの表示を繰り返し進まくなってしまいました。
Ctrl+Cを2回押し中断し、vagrant provision
を実行すると、rsync
の際に失敗し同時に下記のエラーが表示されます。
sudo: sorry, you must have a tty to run sudo
sudoresファイルを下記の通り編集することでrsync
することはできました。
$ vagrant ssh
% cat /etc/sudoers
# 略
Defaults requiretty
Defaults:root requiretty
環境:
macOS Sierra 10.12.4
vagrant version 1.9.4
vagrant-conoha 0.1.7
conoha.image vmi-centos-7.2-amd64-20gb
(from Vagrantfile)
Vagrant 1.9.1でプラグインをインストールしようとすると、
以下のエラーが出力され、プラグイン自体がインストールできない
/opt/vagrant/embedded/lib/ruby/2.2.0/rubygems/specification.rb:2100:in `check_version_conflict': can't activate mime-types-1.25.1, already activated mime-types-3.1 (Gem::LoadError)
from /opt/vagrant/embedded/lib/ruby/2.2.0/rubygems/specification.rb:1276:in `activate'
from /opt/vagrant/embedded/gems/gems/vagrant-1.9.1/lib/vagrant/bundler.rb:323:in `block in activate_solution'
from /opt/vagrant/embedded/gems/gems/vagrant-1.9.1/lib/vagrant/bundler.rb:320:in `each'
from /opt/vagrant/embedded/gems/gems/vagrant-1.9.1/lib/vagrant/bundler.rb:320:in `activate_solution'
from /opt/vagrant/embedded/gems/gems/vagrant-1.9.1/lib/vagrant/bundler.rb:248:in `internal_install'
from /opt/vagrant/embedded/gems/gems/vagrant-1.9.1/lib/vagrant/bundler.rb:98:in `install'
from /opt/vagrant/embedded/gems/gems/vagrant-1.9.1/lib/vagrant/plugin/manager.rb:62:in `block in install_plugin'
from /opt/vagrant/embedded/gems/gems/vagrant-1.9.1/lib/vagrant/plugin/manager.rb:72:in `call'
from /opt/vagrant/embedded/gems/gems/vagrant-1.9.1/lib/vagrant/plugin/manager.rb:72:in `install_plugin'
from /opt/vagrant/embedded/gems/gems/vagrant-1.9.1/plugins/commands/plugin/action/install_gem.rb:37:in `call'
from /opt/vagrant/embedded/gems/gems/vagrant-1.9.1/lib/vagrant/action/warden.rb:34:in `call'
from /opt/vagrant/embedded/gems/gems/vagrant-1.9.1/lib/vagrant/action/builder.rb:116:in `call'
from /opt/vagrant/embedded/gems/gems/vagrant-1.9.1/lib/vagrant/action/runner.rb:66:in `block in run'
from /opt/vagrant/embedded/gems/gems/vagrant-1.9.1/lib/vagrant/util/busy.rb:19:in `busy'
from /opt/vagrant/embedded/gems/gems/vagrant-1.9.1/lib/vagrant/action/runner.rb:66:in `run'
from /opt/vagrant/embedded/gems/gems/vagrant-1.9.1/plugins/commands/plugin/command/base.rb:14:in `action'
from /opt/vagrant/embedded/gems/gems/vagrant-1.9.1/plugins/commands/plugin/command/install.rb:32:in `block in execute'
from /opt/vagrant/embedded/gems/gems/vagrant-1.9.1/plugins/commands/plugin/command/install.rb:31:in `each'
from /opt/vagrant/embedded/gems/gems/vagrant-1.9.1/plugins/commands/plugin/command/install.rb:31:in `execute'
from /opt/vagrant/embedded/gems/gems/vagrant-1.9.1/plugins/commands/plugin/command/root.rb:66:in `execute'
from /opt/vagrant/embedded/gems/gems/vagrant-1.9.1/lib/vagrant/cli.rb:42:in `execute'
from /opt/vagrant/embedded/gems/gems/vagrant-1.9.1/lib/vagrant/environment.rb:308:in `cli'
from /opt/vagrant/embedded/gems/gems/vagrant-1.9.1/bin/vagrant:127:in `<main>'
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.