nimbusproject / nimbus

Nimbus - Open Source Cloud Computing Software - 100% Apache2 licensed
http://www.nimbusproject.org/
197 stars 82 forks source link

Fix error message when /root/.ssh/ doesn't exist. #96

Closed oldpatricka closed 12 years ago

oldpatricka commented 12 years ago

Right now, when a user tries to boot an image with no /root/.ssh/ directory, the error at the end of this bug is printed. At the very least, this message should make the problem more obvious, but this might also be a good time to revisit the idea that Nimbus shouldn't create this directory automatically.

Altering image (dryrun = false):

command = /bin/mount -o loop,noexec,nosuid,nodev,noatime,sync,offset=1048576 /opt/nimbus/var/workspace-control/secureimages/wrksp-17406/tmp9sbt4hRepo__VMS__common__r2-worker /opt/nimbus/var/workspace-control/mnt/wrksp-17406
  - successful
command = /bin/cp /opt/nimbus/var/workspace-control/tmp/5343a327-39c1-4a57-b0e6 /opt/nimbus/var/workspace-control/mnt/wrksp-17406//root/.ssh/authorized_keys
/bin/cp: cannot create regular file `/opt/nimbus/var/workspace-control/mnt/wrksp-17406//root/.ssh/authorized_keys': No such file or directory
command = /bin/umount -d -f /opt/nimbus/var/workspace-control/mnt/wrksp-17406
  - successful
===========================================================================
Traceback (most recent call last):
  File "/opt/nimbus/src/python/workspacecontrol/main/wc_core.py", line 79, in core
    _core(vm_name, action, p, c)
  File "/opt/nimbus/src/python/workspacecontrol/main/wc_core.py", line 168, in _core
    wc_core_creation.create(vm_name, p, c, async, editing, images, kernels, localnet, netbootstrap, netlease, netsecurity, persistence, platform)
  File "/opt/nimbus/src/python/workspacecontrol/main/wc_core_creation.py", line 16, in create
    _create_local(vm_name, p, c, async, editing, images, kernels, localnet, netbootstrap, netlease, netsecurity, persistence, platform)
  File "/opt/nimbus/src/python/workspacecontrol/main/wc_core_creation.py", line 31, in _create_local
    _common(local_file_set, vm_name, p, c, editing, kernels, localnet, netbootstrap, netlease, netsecurity, persistence, platform, justprint=justprint)
  File "/opt/nimbus/src/python/workspacecontrol/main/wc_core_creation.py", line 54, in _common
    editing.process_after_procurement(local_file_set)
  File "/opt/nimbus/src/python/workspacecontrol/defaults/ImageEditing.py", line 250, in process_after_procurement
    self._doMountCopyTasks(rootdisk, vm_name, mnttask_list, hdimage)
  File "/opt/nimbus/src/python/workspacecontrol/defaults/ImageEditing.py", line 420, in _doMountCopyTasks
    self._doOneMountCopyTask(imagepath, src, task[1], mntpath, hdimage)
  File "/opt/nimbus/src/python/workspacecontrol/defaults/ImageEditing.py", line 482, in _doOneMountCopyTask
    raise IncompatibleEnvironment(combined)
IncompatibleEnvironment: 
===========================================================================

Tried multiple methods of mounting the image file.

First, attempted to treat it like partition (no MBR) but that did not work:

===========================================================================
problem running command: '/usr/bin/sudo /opt/nimbus/libexec/workspace-control/mount-alter.sh one /opt/nimbus/var/workspace-control/secureimages/wrksp-17406/tmp9sbt4hRepo__VMS__common__r2-worker /opt/nimbus/var/workspace-control/mnt/wrksp-17406 /opt/nimbus/var/workspace-control/tmp/5343a327-39c1-4a57-b0e6 /root/.ssh/authorized_keys' ::: return code: 1280 ::: output:
/opt/nimbus/libexec/workspace-control/mount-alter.sh received these arguments: 
  - subcommand: one
  - imagefile: /opt/nimbus/var/workspace-control/secureimages/wrksp-17406/tmp9sbt4hRepo__VMS__common__r2-worker
  - mountpoint: /opt/nimbus/var/workspace-control/mnt/wrksp-17406
  - datafile: /opt/nimbus/var/workspace-control/tmp/5343a327-39c1-4a57-b0e6
  - datatarget: /root/.ssh/authorized_keys

Checking input:
  - IMAGE_DIR: /opt/nimbus/var/workspace-control/secureimages/
           OK: /opt/nimbus/var/workspace-control/secureimages/wrksp-17406/tmp9sbt4hRepo__VMS__common__r2-worker
  - MOUNTPOINT_DIR: /opt/nimbus/var/workspace-control/mnt/
                OK: /opt/nimbus/var/workspace-control/mnt/wrksp-17406
  - FILE_DIR: /opt/nimbus/var/workspace-control/tmp/
          OK: /opt/nimbus/var/workspace-control/tmp/5343a327-39c1-4a57-b0e6
  - target OK: /root/.ssh/authorized_keys

Altering image (dryrun = false):

command = /bin/mount -o loop,noexec,nosuid,nodev,noatime,sync /opt/nimbus/var/workspace-control/secureimages/wrksp-17406/tmp9sbt4hRepo__VMS__common__r2-worker /opt/nimbus/var/workspace-control/mnt/wrksp-17406
mount: you must specify the filesystem type
===========================================================================

Then, attempted to look for the first partition in the partition table using
fdisk, but that did not work either:

===========================================================================
problem running command: '/usr/bin/sudo /opt/nimbus/libexec/workspace-control/mount-alter.sh hdone /opt/nimbus/var/workspace-control/secureimages/wrksp-17406/tmp9sbt4hRepo__VMS__common__r2-worker /opt/nimbus/var/workspace-control/mnt/wrksp-17406 /opt/nimbus/var/workspace-control/tmp/5343a327-39c1-4a57-b0e6 /root/.ssh/authorized_keys 1048576' ::: return code: 1792 ::: output:
/opt/nimbus/libexec/workspace-control/mount-alter.sh received these arguments: 
  - subcommand: hdone
  - imagefile: /opt/nimbus/var/workspace-control/secureimages/wrksp-17406/tmp9sbt4hRepo__VMS__common__r2-worker
  - mountpoint: /opt/nimbus/var/workspace-control/mnt/wrksp-17406
  - datafile: /opt/nimbus/var/workspace-control/tmp/5343a327-39c1-4a57-b0e6
  - datatarget: /root/.ssh/authorized_keys
  - offset: 1048576

Checking input:
  - IMAGE_DIR: /opt/nimbus/var/workspace-control/secureimages/
           OK: /opt/nimbus/var/workspace-control/secureimages/wrksp-17406/tmp9sbt4hRepo__VMS__common__r2-worker
  - MOUNTPOINT_DIR: /opt/nimbus/var/workspace-control/mnt/
                OK: /opt/nimbus/var/workspace-control/mnt/wrksp-17406
  - FILE_DIR: /opt/nimbus/var/workspace-control/tmp/
          OK: /opt/nimbus/var/workspace-control/tmp/5343a327-39c1-4a57-b0e6
  - target OK: /root/.ssh/authorized_keys

Altering image (dryrun = false):

command = /bin/mount -o loop,noexec,nosuid,nodev,noatime,sync,offset=1048576 /opt/nimbus/var/workspace-control/secureimages/wrksp-17406/tmp9sbt4hRepo__VMS__common__r2-worker /opt/nimbus/var/workspace-control/mnt/wrksp-17406
  - successful
command = /bin/cp /opt/nimbus/var/workspace-control/tmp/5343a327-39c1-4a57-b0e6 /opt/nimbus/var/workspace-control/mnt/wrksp-17406//root/.ssh/authorized_keys
/bin/cp: cannot create regular file `/opt/nimbus/var/workspace-control/mnt/wrksp-17406//root/.ssh/authorized_keys': No such file or directory
command = /bin/umount -d -f /opt/nimbus/var/workspace-control/mnt/wrksp-17406
  - successful
===========================================================================

Problem with environment: 
===========================================================================

Tried multiple methods of mounting the image file.

First, attempted to treat it like partition (no MBR) but that did not work:

===========================================================================
problem running command: '/usr/bin/sudo /opt/nimbus/libexec/workspace-control/mount-alter.sh one /opt/nimbus/var/workspace-control/secureimages/wrksp-17406/tmp9sbt4hRepo__VMS__common__r2-worker /opt/nimbus/var/workspace-control/mnt/wrksp-17406 /opt/nimbus/var/workspace-control/tmp/5343a327-39c1-4a57-b0e6 /root/.ssh/authorized_keys' ::: return code: 1280 ::: output:
/opt/nimbus/libexec/workspace-control/mount-alter.sh received these arguments: 
  - subcommand: one
  - imagefile: /opt/nimbus/var/workspace-control/secureimages/wrksp-17406/tmp9sbt4hRepo__VMS__common__r2-worker
  - mountpoint: /opt/nimbus/var/workspace-control/mnt/wrksp-17406
  - datafile: /opt/nimbus/var/workspace-control/tmp/5343a327-39c1-4a57-b0e6
  - datatarget: /root/.ssh/authorized_keys

Checking input:
  - IMAGE_DIR: /opt/nimbus/var/workspace-control/secureimages/
           OK: /opt/nimbus/var/workspace-control/secureimages/wrksp-17406/tmp9sbt4hRepo__VMS__common__r2-worker
  - MOUNTPOINT_DIR: /opt/nimbus/var/workspace-control/mnt/
                OK: /opt/nimbus/var/workspace-control/mnt/wrksp-17406
  - FILE_DIR: /opt/nimbus/var/workspace-control/tmp/
          OK: /opt/nimbus/var/workspace-control/tmp/5343a327-39c1-4a57-b0e6
  - target OK: /root/.ssh/authorized_keys

Altering image (dryrun = false):

command = /bin/mount -o loop,noexec,nosuid,nodev,noatime,sync /opt/nimbus/var/workspace-control/secureimages/wrksp-17406/tmp9sbt4hRepo__VMS__common__r2-worker /opt/nimbus/var/workspace-control/mnt/wrksp-17406
mount: you must specify the filesystem type
===========================================================================

Then, attempted to look for the first partition in the partition table using
fdisk, but that did not work either:

===========================================================================
problem running command: '/usr/bin/sudo /opt/nimbus/libexec/workspace-control/mount-alter.sh hdone /opt/nimbus/var/workspace-control/secureimages/wrksp-17406/tmp9sbt4hRepo__VMS__common__r2-worker /opt/nimbus/var/workspace-control/mnt/wrksp-17406 /opt/nimbus/var/workspace-control/tmp/5343a327-39c1-4a57-b0e6 /root/.ssh/authorized_keys 1048576' ::: return code: 1792 ::: output:
/opt/nimbus/libexec/workspace-control/mount-alter.sh received these arguments: 
  - subcommand: hdone
  - imagefile: /opt/nimbus/var/workspace-control/secureimages/wrksp-17406/tmp9sbt4hRepo__VMS__common__r2-worker
  - mountpoint: /opt/nimbus/var/workspace-control/mnt/wrksp-17406
  - datafile: /opt/nimbus/var/workspace-control/tmp/5343a327-39c1-4a57-b0e6
  - datatarget: /root/.ssh/authorized_keys
  - offset: 1048576

Checking input:
  - IMAGE_DIR: /opt/nimbus/var/workspace-control/secureimages/
           OK: /opt/nimbus/var/workspace-control/secureimages/wrksp-17406/tmp9sbt4hRepo__VMS__common__r2-worker
  - MOUNTPOINT_DIR: /opt/nimbus/var/workspace-control/mnt/
                OK: /opt/nimbus/var/workspace-control/mnt/wrksp-17406
  - FILE_DIR: /opt/nimbus/var/workspace-control/tmp/
          OK: /opt/nimbus/var/workspace-control/tmp/5343a327-39c1-4a57-b0e6
  - target OK: /root/.ssh/authorized_keys

Altering image (dryrun = false):

command = /bin/mount -o loop,noexec,nosuid,nodev,noatime,sync,offset=1048576 /opt/nimbus/var/workspace-control/secureimages/wrksp-17406/tmp9sbt4hRepo__VMS__common__r2-worker /opt/nimbus/var/workspace-control/mnt/wrksp-17406
  - successful
command = /bin/cp /opt/nimbus/var/workspace-control/tmp/5343a327-39c1-4a57-b0e6 /opt/nimbus/var/workspace-control/mnt/wrksp-17406//root/.ssh/authorized_keys
/bin/cp: cannot create regular file `/opt/nimbus/var/workspace-control/mnt/wrksp-17406//root/.ssh/authorized_keys': No such file or directory
command = /bin/umount -d -f /opt/nimbus/var/workspace-control/mnt/wrksp-17406
  - successful
===========================================================================

Exiting with error code: 3

Workspace "vm-142" did NOT reach target state "Running"

Problem running 'vm-142'.