VMPerl 을 사용해서 Virtual Machine에 device connect하기에 대한 질문 입니다.

hyper9의 이미지

VMPerl script를 사용해서 Virtual machine에 CDROM을 connect하고
disconnect하려고 합니다.

일단 현재 만들어진 Virtual Machine은 512M의 Memory, 10GB의 HDD
, Ethernet 1개, mouse한개, processor한개로 구성되어 있습니다.

vmx file의 내용은 아래와 같습니다.

config.version = "8"
virtualHW.version = "4"
scsi0.present = "TRUE"
memsize = "512"
scsi0:0.present = "TRUE"
scsi0:0.fileName = "TEST.vmdk"
scsi0:0.writeThrough = "TRUE"
ide1:0.present = "FALSE"
ide1:0.fileName = "/dev/scd0"
ide1:0.deviceType = "cdrom-raw"
floppy0.startConnected = "FALSE"
floppy0.fileName = "/dev/fd0"
Ethernet0.present = "TRUE"
displayName = "TEST"
guestOS = "redhat"
priority.grabbed = "normal"
priority.ungrabbed = "normal"
powerType.powerOff = "hard"
powerType.powerOn = "hard"
powerType.suspend = "hard"
powerType.reset = "hard"

floppy0.present = "FALSE"

제가 사용하는 Perl Script의 내용은 다음과 같은 작업을 합니다.
$vm->start()
$vm->set_config("ide1:0.deviceType","cdrom-image")
$vm->set_config("ide1:0.fileName","/root/FC4-i386-DVD.iso")
$vm->connect_device("ide1:0")
$vm->disconnect_device("ide1:0")

하지만 위에서 4번째인 connect_device method를 실행할 때 항상 error가 발생하고
그 error message는 "Error -3: Invalid arguments: no such device" 입니다.

어떤 것이 잘못되었는지 조언을 부탁드리고 싶습니다.
제가 사용한 script는 다음과 같습니다.

#!/usr/bin/perl -w
 
use VMware::VmPerl;
use VMware::VmPerl::VM;
use VMware::VmPerl::ConnectParams;
use strict;
 
# Retrieves a pre-defined constant value.
sub vm_constant {
  my $constant_str = shift;
  return VMware::VmPerl::constant ($constant_str, 0);
}
 
if (@ARGV < 1) {
  print "Usage $0: <path_to_config_file> [<server> <user> <password>]\n";
  exit(1);
}
 
# Read in parameters.
my ($cfg_path, $server_name, $user, $passwd) = @ARGV;
 
# Use the default port of 902. Change this if your port is different.
my $port = 904;
 
my $connect_params = VMware::VmPerl::ConnectParams::new($server_name,$port,$user,$passwd);
my $vm = VMware::VmPerl::VM::new();
 
if (!$vm->connect($connect_params, $cfg_path)) {
  my ($error_number, $error_string) = $vm->get_last_error();
  die "Could not connect to vm: Error $error_number: $error_string \n";
}
 
$vm->start();
if(!$vm->set_config("ide1:0.deviceType","cdrom-image"))
{
  my ($error_number, $error_string) = $vm->get_last_error();
  die "Could not set deviceType : Error $error_number: $error_string \n";
}
 
if(!$vm->set_config("ide1:0.fileName","/root/FC4-i386-DVD.iso"))
{
  my ($error_number, $error_string) = $vm->get_last_error();
  die "Could not set fileName : Error $error_number: $error_string \n";
}
 
if(!$vm->connect_device("ide1:0"))
{
  my ($error_number, $error_string) = $vm->get_last_error();
  die "Could not connect device ide1:0 : Error $error_number: $error_string \n";
}
 
if(!$vm->disconnect_device("ide1:0"))
{
  my ($error_number, $error_string) = $vm->get_last_error();
  die "Could not disconnect cdrom : Error $error_number: $error_string \n";
}
 
$vm->stop();
 
# Destroys the virtual machine object, thus disconnecting from the virtual machine.
undef $vm;
aero의 이미지

설정에
ide1:0.present = "FALSE"
이렇게 되어 있어서 그런거 아닌가요 ?

코드 돌아가는 모양새를 보니
$vm->start(); 다음에

$vm->set_config("ide1:0.present","TRUE");
를 추가해서 설정을 TRUE로 바꾸면 될듯?

hyper9의 이미지

어떤 이유때문에 실제로 vmx file의 수정자체가 안되는건지,
아니면 제가 잘못하고 있는 것이 있는지는 정확히 모르지만,

ide1:0.present가 FALSE로 되어 있는 것을 VMPerl script에서
TRUE로 바꾸는 것이 안되는 것 같아 보이네요.

음..더 알아보고 또 update하겠습니다.

댓글 달기

Filtered HTML

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

BBCode

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param>
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

Textile

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • You can use Textile markup to format text.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Markdown

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • Quick Tips:
    • Two or more spaces at a line's end = Line break
    • Double returns = Paragraph
    • *Single asterisks* or _single underscores_ = Emphasis
    • **Double** or __double__ = Strong
    • This is [a link](http://the.link.example.com "The optional title text")
    For complete details on the Markdown syntax, see the Markdown documentation and Markdown Extra documentation for tables, footnotes, and more.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Plain text

  • HTML 태그를 사용할 수 없습니다.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 줄과 단락은 자동으로 분리됩니다.
댓글 첨부 파일
이 댓글에 이미지나 파일을 업로드 합니다.
파일 크기는 8 MB보다 작아야 합니다.
허용할 파일 형식: txt pdf doc xls gif jpg jpeg mp3 png rar zip.
CAPTCHA
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.