[chef-dev] Re: [chef] Re: Fwd: Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: "knife-vsphere vm vmdk add" cannot find VM


Chronological Thread 
  • From: Anna Redding < >
  • To: Daniel Condomitti < >
  • Cc: " " < >, " " < >
  • Subject: [chef-dev] Re: [chef] Re: Fwd: Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: "knife-vsphere vm vmdk add" cannot find VM
  • Date: Tue, 25 Mar 2014 13:27:23 -0500

Thank you Daniel, I'll see what I can figure out.  


Sent from my iPhone

On Mar 25, 2014, at 1:15 PM, Daniel Condomitti < "> > wrote:

The easiest way to debug this would be to use Pry[0]. Insert a binding.pry on this line https://github.com/ezrapagel/knife-vsphere/blob/master/lib/chef/knife/vsphere_vm_vmdk_add.rb#L76 and step through it [1] to see why the regex on the following line isn’t matching the vmdks already stored. You’ll need a “require ‘pry’” at the top of the file as well.

I don’t see any open issues in the github project about this but you may try and submit one. I haven’t used knife-vsphere to create extra vmdks but might give it a shot later this afternoon.


On Tuesday, March 25, 2014 at 8:37 AM, Anna Redding wrote:

All,

I need help from the knife-vsphere developers.  Email below was established with the general distribution.  I've been trying to get this to work for over a week. I found out yesterday that funding stops "end of month".  So any help is truly appreciate. 

I need help specifically with the "vmdk add" feature for knife-vsphere. 
Chef and knife versions are:
Chef-server        11.0.6-1
   Chef client          11.4.0-1
   Knife-vsphere     0.9.8 
   OS                      RHEL 6.1

First issue was that the command (annotated below) would fail saying "Could not find VMname", which I believe would be better described as the vsphere folder name created on the data store for the VM. After many different attempts, I tried shortening the length of the name from 17chars to 14 and it worked. So that's problem #1 that has a temporary work around but not one acceptable for long term.  

Problem #2
After shortening the name, the command fails because it says the vmdk already exists. Well, when the VM is cloned (also using knife-vsphere), it creates a primary vmdk after the name of the VM (VMname.vmdk) But more importantly, the folder where it resides on the data store is the name of the VM. So,  when I issue the "vmdk add" options, it 'acts' it appears to be trying to create the primary folder again as it fails saying it is a duplicate name. If I try placing the additional  vmdk on a 'different' datastore from the primary VMs vmdk, it works but if I try to create a third vmdk on the same datastore as vmdk#2, it again fails saying it already exists. If I place the third vmdk on a different datastore, it creates but creates it with the same name as vmdk#2. 

The following behavior is what I believe is happening, the "vmdk add" option is trying to create the original folder for the primary vmdk, it fails if the target data store is the same as the primary's and it would be because the folder was created when the VM was cloned.   If the target is an alternate data store, it works for the first vmdk, then fails for any additional placed on the same datastore for the same VM.  If you place it on a separate data store it works but does not increment the 'counter' in the suffix of your data store name, naming it as if it were the first add-on vmdk. 

In other words, it 'should' create as follows:
[datastore#1]vmname.vmdk
[datastore#1]vmname_1.vmdk
[datastore#1]vmname_2.vmdk

Or something like:
[datastore#1]vmname.vmdk
[datastore#2]vmname_1.vmdk
[datastore#3]vmname_2.vmdk

Instead, creates the names as:
[datastore#1]vmname.vmdk
[datastore#2]vmname_1.vmdk
[datastore#3]vmname_1.vmdk

And if you put on the 'same' datastore, it fails saying it already exists. 

Again, I appreciate your help. 
Anna


All - I don't know who will be happier me or you when I finally get this project completed...

As previously noted, I discovered there is a character limitation to the vsphere VM hostname  in order for the " knife-vsphere vm vmdk add ..." command to work.  (BTW:  Is this limitation documented somewhere? I can't find it)

So for testing purposes, I shortened the hostname and rebuilt the VM. The "knife-vsphere vm vmdk add ..." command does see the VM on the data store
BUT
 when it goes to create the first 'add-on' vmdk, it fails because it says it already exists.  

So, in summary:
- I tried putting the vmdk to a different data store than the primary vm's vmdk 

- The vmdk was created (VMname_1.vmdk)
BUT

- it fails  to attach the VMDK  to the VM with the following error:
     "undefined method 'deviceInfo' for nil:NilClass (NoMethodError)"

- tried to create another vmdk on a third data store 

It created the vmdk
BUT 

- it failed to attach to the VM with same error about the deviceInfo 
AND 
MORE IMPORTANTLY, 

- the vmdk suffix was not correctly incremented. (created as VMname_1.vmdk but
should have been VMname_2.vmdk)

So the two problems I'm seeing with the vmdk add option are:

1- additional VMDKs will not create on the same data store as the initial vm vmdk. Fails saying already exists 

2- additional VMDKs will create on separate data stores but do not properly attach to the master VM, do not recognize each others existence.  Fail with "undefined method 'deviceInfo'"

Are only certain disk device types recognized and are they documented somewhere?  What am I missing here?

HELP PLEASE!!!!!

Oh, also, I AM using the 0.9.8   knife-vsphere plugin. (I was having problem with 0.9.7 and upgraded). 

Here is my command (spaced out for readability):
knife vsphere vm vmdk add      
    AnnaHostVM
    4 
    --vmdk-type  thin 
    --vsdc  <vsDataCenter>   
    --vshost  <vsHost>   
    --target-lun  <datastore1>
    --vsport  443
    --vsinsecure 
    --verbose
    --config  ~/home/areddin/.chef  


I sure hope someone has some ideas....



Sent from my iPhone

On Mar 21, 2014, at 11:56 AM, Anna Redding < "> > wrote:

No, not using bundler. 
I will uninstall and see what the puts give me in the vmdk names. 

Also, do you happen to know what the character limitations are for hostnames, more specifically, VM names?


Sent from my iPhone

On Mar 21, 2014, at 11:46 AM, Robert Tsai < "> > wrote:

Hi Anna,

Glad to hear you found the issue.  Are you using bundler?  If not, you might want to just uninstall 0.9.7.

-Robert


On Fri, Mar 21, 2014 at 8:28 AM, Anna Redding < " target="_blank"> > wrote:
Robert, etal. 

Well, I finally figured out what was going on.  It appears there is a limit on the number of characters you can have in the hostname.  I took a shot in the dark and changed my VM name to 
annachefvm and it worked was able to find it. 

Now, though, I'm having another problem. When I create my VM, it is on, say, ds01, created as [ds01]annachefvm.vmdk. 
When I run the script to create the additional vmdk's, one of which is on ds01 which I believe  'should' create as:
[ds01]annachefvm_1.vmdk 
and another on ds02, which should create as:
[ds02]annachefvm_2.vmdk 
the command fails saying the vmdk already exists.  For some reason, it sees annachefvm already there and stops instead of creating it with the suffix.  (I have verified that there wasn't, by some fluke, already a vmdk out there by the same name)

Any suggestions?

And secondary to that, after installing knife-vsphere 0.9.8, it appears to still be executing 0.9.7
I confirmed 0.9.8 installed (gems list shows knife-vsphere (0.9.7,0.9.8)
How do I force it to use a specific version or am I suppose to uninstall 0.9.7 first (which I thought multiple version could exist due to other potential application requirements.). I know 0.9.8 isn't executing because I added some 'puts' and none of them executed. 

So suggestions for that as well would be much appreciated 

I'm so incredibly far behind in this. We only have a handful of people who know chef and the only one who has worked with the vsphere plugin is not available, plus being in a close area just makes it impossible to troubleshoot in a timely manner. Doing the work in an unclassified lab as suggested would be great but some of our contracts do not allow us to bill work done outside of the controlled area.  

Anyway, I digress with my whiney story.  I would truly appreciate any suggestions on the above two issues. 

Thanks again for the help, mostly for your patience as I bumble through this learning process  !!!  

Anna



Sent from my iPhone
Robert

Thank you for your line command. Unfortunately, it did not answer the issue but it told me that the next thing I was going to try wasn't going to work.  
When I printed the code for 0.9.8, I noticed references to the variable specifying the target lun was defined with an underscore as  "target_lun". 
I thought the might be the problem as I have been using a dash not an underscore ... but your example negated that because you use the 'dash' not the underscore. 

I cannot give exact command bc the system is in a secured area but I did write down the various pieces so here it is:

strace  -o  /tmp/strace-vsphere.out  knife  vsphere  vm  vmdk  add  annaVM  4   --vmdk-type  thick   --vsdc  ISP   --vshost  <vcIP>  --target-lun  ds03   --vsport  443   --vsinsecure  -VV 

When I looked at the strace, the DEBUG sections appeared to reflect the correct values.

After reviewing the 22k+ lines of strace info, I could not find any messages that jumped out, definitely none that were  preceded by the DEBUG flag. 

Any other ideas?
Anna



Sent from  my iPhone
Hi Anna,

Sorry to hear its still not working for you.  The command I used was knife vsphere vm vmdk add vmname 3 --target-lun SSDGuest

 knife vsphere vm vmdk  vmname 3 --target-lun SSDGuest
[fog][WARNING] Unable to load the 'unf' gem. Your AWS strings may not be properly encoded.
Digest::Digest is deprecated; use Digest
DEBUG: value for config item vsphere_host: 2.2.2.2
DEBUG: value for config item vshere_path:
DEBUG: value for config item vsphere_port: 443
DEBUG: value for config item vsphere_nossl:
DEBUG: value for config item vsphere_user: testuser
DEBUG: value for config item vsphere_pass: testpassword
DEBUG: value for config item vsphere_insecure: true
DEBUG: value for config item proxy_host:
DEBUG: value for config item proxy_port:
DEBUG: value for config item vsphere_host: 2.2.2.2
DEBUG: value for config item vshere_path:
DEBUG: value for config item vsphere_port: 443
DEBUG: value for config item vsphere_nossl:
DEBUG: value for config item vsphere_user: testuser
DEBUG: value for config item vsphere_pass: testpassword
DEBUG: value for config item vsphere_insecure: true
DEBUG: value for config item proxy_host:
DEBUG: value for config item proxy_port:
DEBUG: value for config item folder:
DEBUG: value for config item vsphere_dc: testdc

DEBUG: value for config item vsphere_dc: testdc
this is point1   * I added the puts to see what vm name would return
VirtualMachine("vm-981") *
this is point2  *
DEBUG: value for config item target_lun:
Datastore: SSDGuest (741.57 GB(796250865664) / 2.00 TB)
DEBUG: value for config item vsphere_dc: testbed
Choosing: SSDGuest
DEBUG: value for config item vmdk_type: thin
Next vmdk name is => [SSDGuest] vmname/vmname_1.vmdk
Creating VMDK
Capacity: 3 GB
Disk: [SSDGuest] vmname/vmname_1.vmdk
DEBUG: value for config item noop:
DEBUG: value for config item vsphere_dc: testbed
Attaching VMDK to vmname
using SCSI controller 0
using SCSI ID 1
DEBUG: value for config item noop:
D, [2014-03-20T10:11:57.458010 #26166] DEBUG -- : Shutdown completed cleanly

Can you output the command you used and the results?

Thanks,
Robert



On Thu, Mar 20, 2014 at 9:34 AM, Anna Redding < " target="_blank"> > wrote:
Robert,

Would you share your line command (substituting the proprietary info of course)?

I upgraded to 0.9.8 and still not working. It just has to be something with the command format/content. 

The "knife vsphere vm 'list' ..." works fine. The 'vmdk add' does not. 

Much appreciated,

Anna


Sent from my iPhone
What version of the pluggin are you using?  I am using 0.9.8 and I am able to use the knife vsphere vm vmdk add VM SIZE command with no issues.


On Tue, Mar 18, 2014 at 9:38 AM, Robert Tsai < " target="_blank"> > wrote:
btw Does the "knife vsphere vm state" command work for you?


On Tue, Mar 18, 2014 at 8:51 AM, Anna Redding < " target="_blank"> > wrote:
Yes I have tried that and it was either an invalid option or it failed (don't remember which). I have also tried --dest-folder which I used in the cloning step ... Also a no-go 


Sent from my iPhone
Hi Anna,

Have you tried adding the --folder FOLDER option where the vm resides? I haven't used the "knife vsphere vm vmdk add" command yet.  I'll test it and let you know if get the same results.
-Robert


On Tue, Mar 18, 2014 at 8:16 AM, Anna Redding < " target="_blank"> > wrote:
Thank you for replying.
> Post a verbose output
   Unfortunately I am running this in a closed area without Internet access.

> which call fails
The best I can tell using strace and the -vv option is the calls to PropertyFilterSpec.rb
TypeName.rb
PropertyPath.rb
ObjectSpec.rb
All fail with -1 return code and error "No such file or directory"
Then several lines of data that looks like registry or pointer values print out followed by the message
"Could not find <VMname>"


>
> Did you try knife-vsphere devs:
No, but now that I know there's a specific support group, I definitely will.


Let me know if the above triggers any ideas.

Thanks
Anna

Sent from my iPhone

On Mar 17, 2014, at 4:02 PM, Aimelyne Mochiron < " target="_blank"> > wrote:

> Hi Anna,
>
> Could you please post a verbose output (-VV flag)? At the least, knowing which call fails would be useful.
>
> Did you try and run your issue past the knife-vsphere devs: https://github.com/ezrapagel/knife-vsphere?
>
> am
>
> On 17 Mar 2014, at 19:25, Anna Redding < " target="_blank"> > wrote:
>
>> Hello all,
>>
>> I have not heard anything back so re-posting.
>>
>> I 'really' need to get this resolved (see atached email) as the automation code I've written needs to be used to build out an environment tomorrow or Wed. We will have to have manual intervention if I don't get this working and that is what we are trying to eliminate.
>>
>> So ANY' ideas are most welcome!!!!
>>
>> I've tried putting the VM directly under the data center level; I've tried referencing via  IPaddr; I've tried the long form of the hostname; I've verified spelling; I've verified the VM is really on the data store I'm pointing to on the command line... no matter what, I receive the same error indicating it cannot find the VM...yet it was created using the "knife vsphere vm clone" command.
>>
>> What else can it be???
>>
>> Even if you think it's an 'obvious' answer, please run it past me.
>>
>> Thank you in advance.
>> Anna
>>
>>
>> Sent from my iPhone
>>
>> On Mar 14, 2014, at 11:14 AM, Anna Redding < " target="_blank"> > wrote:
>>
>>> All
>>>
>>> Once again, I am perplexed. After cloning my VMs from template (via a script using 'knife vsphere vm clone...'), I am trying to add additional vmdks to each VM so we can create additional mount points on different virtual disks.
>>>
>>> Again, I am using 'knife vsphere' but with the vm vmdk add' arguments. It is erroring stating it cannot find the VM.
>>>
>>> I have verified the VM is on the data store.  I have verified in vcenter, the VM is under the expected folder.
>>>
>>> When I issue the command 'knife vsphere vm vmdk list --recursive ...', I see the VM and it is under the expected folder (called VMbuildout)....
>>> But when I execute the command:
>>> 'knife vsphere vm vmdk add  <VM>...'
>>> It errors with "Cannot find <VM>"
>>>
>>> Oh, also, there are NO special characters in the VM's name.
>>>
>>> So...what am I missing here???
>>>
>>> Thanks in advance,
>>> Anna
>>>
>>>
>>> Sent from my iPhone
>









Archive powered by MHonArc 2.6.16.

§