← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1296532] Re: Network interface should be restarted if instance has a static ip address.

 

** Changed in: cloud-init
       Status: New => Incomplete

** Changed in: cloud-init
       Status: Incomplete => New

** Changed in: cloud-init
       Status: New => Invalid

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to cloud-init.
https://bugs.launchpad.net/bugs/1296532

Title:
  Network interface should be restarted if instance has a static ip
  address.

Status in Init scripts for use on cloud images:
  Invalid

Bug description:
  Network interface should be restarted if instance has a static ip
  address.

  Details are as follows.

  1. create a instance with specifying a static ip address A.

  2. create a snapshot of a instance.

  3. create a instance from snapshot with specifying a static ip address
  B.

    3.1 instance start (At this time, network interface is still specified to use ip address A.)
    3.2 cloud-init edits /etc/network/interface to use ip address B.
    3.3 cloud-init executes ifup command.
        but network interface has already up, so new network information is not reflected.

  
  We have to modify the _bring_up_interface method like this.

  --- cloudinit/distros/__init__.py       2014-02-12 19:56:55 +0000
  +++ cloudinit/distros/__init__.py       2014-03-24 05:59:00 +0000
  @@ -271,11 +271,13 @@
               util.write_file(self.hosts_fn, contents.getvalue(), mode=0644)

       def _bring_up_interface(self, device_name):
  -        cmd = ['ifup', device_name]
  -        LOG.debug("Attempting to run bring up interface %s using command %s",
  -                   device_name, cmd)
  +        cmd_down = ['ifdown', device_name]
  +        cmd_up = ['ifup', device_name]
  +        LOG.debug("Attempting to restart interface %s using command %s %s",
  +                   device_name, cmd_down, cmd_up)
           try:
  -            (_out, err) = util.subp(cmd)
  +            (_out, down_err) = util.subp(cmd_down)
  +            (_out, up_err) = util.subp(cmd_up)

To manage notifications about this bug go to:
https://bugs.launchpad.net/cloud-init/+bug/1296532/+subscriptions


References