]> git.proxmox.com Git - qemu-server.git/commitdiff
qmpclient-qga : build qga command
authorAlexandre Derumier <aderumier@odiso.com>
Sun, 17 Mar 2013 15:09:06 +0000 (16:09 +0100)
committerDietmar Maurer <dietmar@proxmox.com>
Mon, 1 Dec 2014 08:50:12 +0000 (09:50 +0100)
example of command:

first json is guest-sync to sync and flush the client, second json is the command

{ "execute": "guest-sync", "arguments": { "id": 123456 } }{"execute":"guest-ping"}

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
PVE/QMPClient.pm

index 42231dabd8a86cc4e1723b09860ba6bfbb8bc9b3..3401ce3e889b5426e6a4ad16c9b9193e274cd184 100755 (executable)
@@ -189,10 +189,27 @@ my $check_queue = sub {
                delete $cmd->{arguments}->{fd};
            }
 
-           my $qmpcmd = to_json({
-               execute => $cmd->{execute},
-               arguments => $cmd->{arguments},
-               id => $cmd->{id}});
+           my $qmpcmd = undef;
+
+           if($self->{qga}){
+
+               my $qmpcmdid =to_json({
+                   execute => 'guest-sync',
+                   arguments => { id => int($cmd->{id})}});
+
+               $qmpcmd = to_json({
+                   execute => $cmd->{execute},
+                   arguments => $cmd->{arguments}});
+
+               $qmpcmd = $qmpcmdid.$qmpcmd;
+
+           }else{
+
+               $qmpcmd = to_json({
+                   execute => $cmd->{execute},
+                   arguments => $cmd->{arguments},
+                   id => $cmd->{id}});
+           }
 
            if ($fd >= 0) {
                my $ret = PVE::IPCC::sendfd(fileno($fh), $fd, $qmpcmd);